﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/MasterPage.Master" AutoEventWireup="true" CodeBehind="BGM_ReportKPI.aspx.cs" Inherits="KPIS.GERP.GBMS.APP_UI.Form.BGM_ReportKPI"%>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css" ></link>
<script type="text/javascript">
	function openKpiDetails() {
		radopen("BGM_ReportKPI_KPIDetail.aspx");
	}
</script>
<telerik:RadWindowManager 
    ID="RadWindowManager1" 
    ShowContentDuringLoad="false" 
    VisibleStatusbar="false" 
    ReloadOnShow="true" 
    runat="server" 
    Modal="true"
    Style="z-index: 7001" >
    <Windows>
        <telerik:RadWindow ID="TaskLists" runat="server" Width="1000px" Behaviors="Reload, Close" 
            Height='<%# Unit.Pixel(new SsMng().GetUssI(SsMng.SsUserType.Height) - 100) %>'>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager> 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >
</telerik:RadAjaxLoadingPanel>

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rblKPIType">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rblKPIType" LoadingPanelID="RadAjaxLoadingPanel1"/>
                <telerik:AjaxUpdatedControl ControlID="PanelProject" LoadingPanelID="RadAjaxLoadingPanel1"/>
                <telerik:AjaxUpdatedControl ControlID="PanelBgmStrategy" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
   </AjaxSettings>
</telerik:RadAjaxManager>

<div class="DivControl" style="padding-left: 10px; padding-right: 10px; color: #FFFFFF; font-weight: bold; font-size: large;">
    รายงานผลตัวชี้วัด
</div>
<div>
	
    <table >
        <tr>
            <td>
	            <div class="Background710" style="margin:10px 0px 10px 0px;">
					<div class="BackgroundBottom710">
						<asp:RadioButtonList ID="rblKPIType" runat="server" AutoPostBack="true"
							RepeatDirection="Horizontal" 
							onselectedindexchanged="rblKPIType_SelectedIndexChanged" >
							<asp:ListItem Text="ตัวชี้วัดของโครงการ" Value="1"/>
							<asp:ListItem Text="ตัวชี้วัดของกิจกรรมย่อย" Value="2" />
							<asp:ListItem Text="ตัวชี้วัดของกิจกรรมหลัก" Value="3" />
							<asp:ListItem Text="ตัวชี้วัดของผลผลิต" Value="4" />
						</asp:RadioButtonList> 
					</div>
				</div>   
            </td>
        </tr>
    </table>

    <table>
        <tr>
            <td align="right" width="120px">
                หน่วยงาน :
            </td>
            <td>
                <telerik:RadComboBox ID="ddlJobsiteSeq" runat="server"
                    Filter="Contains" AutoPostBack="true" Width="500px"
                    DataTextField="Value" DataValueField="Key" />
            </td>
        </tr>
    </table>

    <asp:Panel ID="PanelProject" runat="server" >
        <table>
            <tr>
                <td align="right" width="120px">
                    โครงการ :
                </td>
                <td>
                    <telerik:RadComboBox ID="ddlBgmProjectSeq" runat="server"
                        Filter="Contains" AutoPostBack="true" Width="500px"
                        DataTextField="Value" DataValueField="Key" />
                </td>
            </tr>
        </table>
        <br />
        <div class="DivInfo">
            <table>
                <tr>
                    <td align="right" width="120px">
                        รหัสโครงการ :
                    </td>
                    <td width="200px">
                        <asp:Label ID="lblBgmProjCode" runat="server" ForeColor="Blue" />
                    </td>
                    <td align="right" width="120px">
                        ปี :
                    </td>
                    <td>
                        <asp:Label ID="lblBgmYear" runat="server" ForeColor="Blue" />
						<asp:Label runat="server" ID="MockHeight" Text='<%# new SsMng().GetUssI(SsMng.SsUserType.Height) %>'></asp:Label>
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        ชื่อโครงการ :
                    </td>
                    <td>
                        <asp:Label ID="lblBgmProjName" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        ผลผลิต :
                    </td>
                    <td>
                        <asp:Label ID="lblOutPut" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        กิจกรรมหลัก :
                    </td>
                    <td>
                        <asp:Label ID="lblAct" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        กิจกรรมย่อย :
                    </td>
                    <td>
                        <asp:Label ID="lblSubAct" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        หน่วยงาน :
                    </td>
                    <td>
                        <asp:Label ID="lblJobsiteName" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table>
                <tr>
                    <td align="right" width="120px">
                        วันเริ่มโครงการ :
                    </td>
                    <td width="200px">
                        <asp:Label ID="lblDateStart" runat="server" ForeColor="Blue" />
                    </td>
                    <td align="right" width="120px">
                        วันสิ้นสุดโครงการ :
                    </td>
                    <td>
                        <asp:Label ID="lblDateEnd" runat="server" ForeColor="Blue" />
                    </td>
                </tr>
            </table>
            <table width="100%">
                <tr>
                    <td align="right" width="120px">
                    </td>
                    <td>
                        <asp:LinkButton ID="cmdViewReason" CssClass="ControlLinkButton" runat="server" Text="หลักการและเหตุผล" />
                        <asp:LinkButton ID="cmdViewObject" CssClass="ControlLinkButton" runat="server" Text="วัตถุประสงค์" />
                        <asp:LinkButton ID="cmdViewTarget" CssClass="ControlLinkButton" runat="server" Text="เป้าหมาย" />
                        <asp:LinkButton ID="cmdViewPlan" CssClass="ControlLinkButton" runat="server" Text="วิธีการดำเนินงาน" />
                    </td>
                </tr>
            </table>
			
            <telerik:RadGrid ID="gridProject" 
			    GroupingSettings-CaseSensitive="false" 
				runat="server" 
				AutoGenerateColumns="False" 
				AllowFilteringByColumn="false"
				Width="980px"
				GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
				GroupingSettings-GroupContinuedFormatString=""
				GroupingSettings-GroupContinuesFormatString=""
				GroupingSettings-GroupSplitFormat="" >
	            

                <MasterTableView NoMasterRecordsText="... ไม่มีข้อมูล ..." 
					CommandItemDisplay="none" 
					GroupLoadMode="Client" 
					Width="100%"
					ShowFooter="true" 
					ShowGroupFooter="true">
                	<CommandItemSettings ExportToPdfText="Export to PDF" />
					<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
						Visible="True">
					</RowIndicatorColumn>
					<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
						Visible="True">
					</ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="bgm_exp_name"
                        FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                        HeaderText="ค่าใช้จ่าย" ItemStyle-HorizontalAlign="Left" 
                        UniqueName="bgm_exp_name" AutoPostBackOnFilter="true"
                        CurrentFilterFunction="Contains" ShowFilterIcon="False"
                        FooterText="รวม :"  >
                        <HeaderStyle HorizontalAlign="Center" Width="140px" />
                        <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="proj_amount"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="ได้รับจัดสรร"
                        UniqueName="proj_amount"
                        AllowFiltering="false" >
                        <HeaderStyle HorizontalAlign="Center" Width="100px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount1"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="โอน/รับโอน"
                        UniqueName="rpt_amount1"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="100px" />
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount8"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="คงเหลือ(จัดสรร)"
                        UniqueName="rpt_amount8"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="100px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount2"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="ได้รับอนุมัติ"
                        UniqueName="rpt_amount2"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="75px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount3"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="จองเงิน"
                        UniqueName="rpt_amount3"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="75px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount4"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="ตั้งเบิก"
                        UniqueName="rpt_amount4"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="75px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount5"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="จ่ายแล้ว"
                        UniqueName="rpt_amount5"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="75px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount6"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="คืนเงิน"
                        UniqueName="rpt_amount6"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="75px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="rpt_amount7"
                        Aggregate="Sum"
                        DataFormatString="{0:n2}"
                        HeaderStyle-HorizontalAlign="Center"
                        HeaderText="คงเหลือ(อนุมัติ)"
                        UniqueName="rpt_amount7"
                        AllowFiltering="false">
                        <HeaderStyle HorizontalAlign="Center" Width="110px"/>
                        <FooterStyle HorizontalAlign="Right"  />
                        <ItemStyle HorizontalAlign="Right" BackColor="LightBlue"  />
                    </telerik:GridBoundColumn>
                </Columns>
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <GroupByFields >
                            <telerik:GridGroupByField FieldName="bgm_source_seq" HeaderText="&nbsp;" />
                        </GroupByFields>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="bgm_source_name" HeaderText="แหล่งเงิน :" HeaderValueSeparator="" />
                        </SelectFields>
                    </telerik:GridGroupByExpression>
                    <telerik:GridGroupByExpression>
                        <GroupByFields >
                            <telerik:GridGroupByField FieldName="bgm_exp_grp_seq" HeaderText="&nbsp;" />
                        </GroupByFields>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="bgm_exp_grp_name" HeaderText="งบรายจ่าย :" HeaderValueSeparator="" />
                        </SelectFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
                	<EditFormSettings>
						<EditColumn FilterControlAltText="Filter EditCommandColumn column">
						</EditColumn>
					</EditFormSettings>
                </MasterTableView>
                <GroupingSettings CaseSensitive="False" 
					GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" GroupContinuedFormatString="" 
					GroupContinuesFormatString="" GroupSplitFormat="" />
				<clientsettings>
					<clientevents />
					<selecting AllowRowSelect="True" />
					<Scrolling AllowScroll="true" FrozenColumnsCount="5" SaveScrollPosition="true" 
						UseStaticHeaders="true" />
					<Resizing AllowColumnResize="True" AllowResizeToFit="True" />
				</clientsettings>
				<FilterMenu EnableImageSprites="False">
				</FilterMenu>
            </telerik:RadGrid>
        </div>
    </asp:Panel>
	
    <asp:Panel ID="PanelBgmStrategy" runat="server" >
        <table>
            <tr>
                <td align="right" width="120px">
                    <asp:Label ID="lblBgmStrategy" runat="server" />
                </td>
                <td>
                    <telerik:RadComboBox ID="ddlBgmStrategySeq" runat="server"
                        Filter="Contains" AutoPostBack="true" Width="500px"
                        DataTextField="text" DataValueField="value" />
                </td>
            </tr>
        </table>

		<Center>
		<telerik:RadGrid ID="gridKPI" runat="server" AllowFilteringByColumn="false" 
			AutoGenerateColumns="False" GroupingSettings-CaseSensitive="false" 
			GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
			GroupingSettings-GroupContinuedFormatString="" 
			GroupingSettings-GroupContinuesFormatString="" 
			GroupingSettings-GroupSplitFormat="" Width="980px">
			<MasterTableView CommandItemDisplay="none" GroupLoadMode="Client" 
				NoMasterRecordsText="... ไม่มีข้อมูล ..." ShowFooter="true" 
				ShowGroupFooter="true" Width="100%">
					<CommandItemSettings ExportToPdfText="Export to PDF" />
					<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" 
						Visible="True">
					</RowIndicatorColumn>
					<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
						Visible="True">
					</ExpandCollapseColumn>
					<Columns>
						<telerik:GridBoundColumn DataField="kpi_seq" UniqueName="kpi_seq" 
							Visible="False" />
						<telerik:GridBoundColumn AutoPostBackOnFilter="true" 
							CurrentFilterFunction="Contains" DataField="kpi_name" FilterControlWidth="100%" 
							FooterText="รวม :" HeaderStyle-HorizontalAlign="Center" 
							HeaderText="ชื่อตัวชี้วัด" ItemStyle-HorizontalAlign="Left" 
							ShowFilterIcon="False" UniqueName="kpi_name">
							<HeaderStyle HorizontalAlign="Center" Width="180px" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="typeKpi" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="ประเภทตัวชี้วัด" 
							UniqueName="typeKpi">
							<HeaderStyle HorizontalAlign="Center" Width="60px" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn> 
						<telerik:GridBoundColumn DataField="unit" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="หน่วยนับ" 
							UniqueName="unit">
							<HeaderStyle HorizontalAlign="Center" Width="60px" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn> 
						<telerik:GridBoundColumn  DataField="weight" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="น้ำหนัก" 
							UniqueName="summaryYearScore">
							<HeaderStyle HorizontalAlign="Center" Width="60px" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn  DataField="summaryYearScore" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="คะแนน" 
							UniqueName="summaryYearScore">
							<HeaderStyle HorizontalAlign="Center" Width="50px" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn AutoPostBackOnFilter="true" 
							CurrentFilterFunction="Contains" DataField="kpi_descr" 
							FilterControlWidth="100%" FooterText="รวม :" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="รายละเอียด" Visible="False"
							ItemStyle-HorizontalAlign="Left" ShowFilterIcon="False" UniqueName="kpi_descr">
							<HeaderStyle HorizontalAlign="Center" />
							<ItemStyle HorizontalAlign="Left" />
						</telerik:GridBoundColumn>
						<telerik:GridBoundColumn DataField="plan1" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="แผน" UniqueName="plan1">
							<HeaderStyle HorizontalAlign="Center" />
						</telerik:GridBoundColumn>
						<telerik:GridTemplateColumn DataField="result1" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="ผล" UniqueName="result1">
							<HeaderStyle HorizontalAlign="Center" />
							<ItemTemplate>   
                                    <asp:LinkButton ID="targetControl" runat="server"                                        
                                        Text='<%# Eval("result1") %>' 
                                        OnClientClick='<%# string.Format("return openKpiDetails()") %>'>
                                    </asp:LinkButton>           
                                </ItemTemplate>   
						</telerik:GridTemplateColumn>
						<telerik:GridBoundColumn DataField="plan2" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="แผน" UniqueName="plan2">
							<HeaderStyle HorizontalAlign="Center" />
						</telerik:GridBoundColumn>
						<telerik:GridTemplateColumn DataField="result2" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="ผล" UniqueName="result2">
							<HeaderStyle HorizontalAlign="Center" />
							<ItemTemplate>   
                                    <asp:LinkButton ID="targetControl" runat="server"                                        
                                        Text='<%# Eval("result2") %>' 
                                        OnClientClick='<%# string.Format("return openKpiDetails()") %>'>
                                    </asp:LinkButton>           
                                </ItemTemplate>   
						</telerik:GridTemplateColumn>
						<telerik:GridBoundColumn DataField="plan3" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="แผน" UniqueName="plan3">
							<HeaderStyle HorizontalAlign="Center" />
						</telerik:GridBoundColumn>
						<telerik:GridTemplateColumn DataField="result3" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="ผล" UniqueName="result3">
							<HeaderStyle HorizontalAlign="Center" />
							<ItemTemplate>   
                                    <asp:LinkButton ID="targetControl" runat="server"                                        
                                        Text='<%# Eval("result3") %>' 
                                        OnClientClick='<%# string.Format("return openKpiDetails()") %>'>
                                    </asp:LinkButton>           
                                </ItemTemplate>   
						</telerik:GridTemplateColumn>
						<telerik:GridBoundColumn DataField="plan4" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="แผน" UniqueName="plan4">
							<HeaderStyle HorizontalAlign="Center" />
						</telerik:GridBoundColumn>
						<telerik:GridTemplateColumn DataField="result4" 
							HeaderStyle-HorizontalAlign="Center" HeaderText="ผล" UniqueName="result4">
							<HeaderStyle HorizontalAlign="Center" />
							<ItemTemplate>   
                                    <asp:LinkButton ID="targetControl" runat="server"                                        
                                        Text='<%# Eval("result4") %>' 
                                        OnClientClick='<%# string.Format("return openKpiDetails()") %>'>
                                    </asp:LinkButton>           
                                </ItemTemplate>   
						</telerik:GridTemplateColumn>
					</Columns>
					<EditFormSettings>
						<EditColumn FilterControlAltText="Filter EditCommandColumn column">
						</EditColumn>
					</EditFormSettings>
			</MasterTableView>
			<GroupingSettings CaseSensitive="False" 
				GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" GroupContinuedFormatString="" 
				GroupContinuesFormatString="" GroupSplitFormat="" />
			<clientsettings>
				<clientevents />
				<selecting AllowRowSelect="True" />
				<Scrolling AllowScroll="true" FrozenColumnsCount="5" SaveScrollPosition="true" 
					UseStaticHeaders="true" />
				<Resizing AllowColumnResize="True" AllowResizeToFit="True" />
			</clientsettings>
			<FilterMenu EnableImageSprites="False">
			</FilterMenu>
		</telerik:RadGrid>
		</Center>

    </asp:Panel>
    
</div>


</asp:Content>
